From bcd3c1612e24af3f1bce8ba4a63d9526c23d03a1 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 2 Nov 2008 22:58:35 +0000 Subject: [PATCH] (bug 16113) Show/hide for redirects in Special:NewPages. Patch by Paul Copperman --- CREDITS | 1 + RELEASE-NOTES | 1 + includes/specials/SpecialNewpages.php | 18 ++++++++++++------ languages/messages/MessagesEn.php | 1 + maintenance/language/messages.inc | 1 + 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CREDITS b/CREDITS index 84a25a5845..6d2ac09695 100644 --- a/CREDITS +++ b/CREDITS @@ -58,6 +58,7 @@ following names for their contribution to the product. * Mormegil * Nathaniel Herman * Nathan Larson +* Paul Copperman * RememberTheDot * ST47 diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 71414959f8..a216ff7c65 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -188,6 +188,7 @@ The following extensions are migrated into MediaWiki 1.14: * (bug 13710) Allow to force "watch this" checkbox via URL using para "watchthis" * (bug 15125) Add Public Domain to default options when installing. Patch by Nathan Larson. * Set a special temporary directory for ImageMagick with $wgImageMagickTempDir +* (bug 16113) Show/hide for redirects in Special:NewPages === Bug fixes in 1.14 === diff --git a/includes/specials/SpecialNewpages.php b/includes/specials/SpecialNewpages.php index 5096d2dabf..35bc265ced 100644 --- a/includes/specials/SpecialNewpages.php +++ b/includes/specials/SpecialNewpages.php @@ -26,6 +26,7 @@ class SpecialNewpages extends SpecialPage { $opts->add( 'hideliu', false ); $opts->add( 'hidepatrolled', false ); $opts->add( 'hidebots', false ); + $opts->add( 'hideredirs', true ); $opts->add( 'limit', (int)$wgUser->getOption( 'rclimit' ) ); $opts->add( 'offset', '' ); $opts->add( 'namespace', '0' ); @@ -58,6 +59,8 @@ class SpecialNewpages extends SpecialPage { $this->opts->setValue( 'hidepatrolled', true ); if ( 'hidebots' == $bit ) $this->opts->setValue( 'hidebots', true ); + if ( 'showredirs' == $bit ) + $this->opts->setValue( 'hideredirs', false ); if ( is_numeric( $bit ) ) $this->opts->setValue( 'limit', intval( $bit ) ); @@ -125,7 +128,8 @@ class SpecialNewpages extends SpecialPage { $filters = array( 'hideliu' => 'rcshowhideliu', 'hidepatrolled' => 'rcshowhidepatr', - 'hidebots' => 'rcshowhidebots' + 'hidebots' => 'rcshowhidebots', + 'hideredirs' => 'newpages-showhideredirs' ); // Disable some if needed @@ -142,8 +146,8 @@ class SpecialNewpages extends SpecialPage { $self = $this->getTitle(); foreach ( $filters as $key => $msg ) { $onoff = 1 - $this->opts->getValue($key); - $link = $this->skin->makeKnownLinkObj( $self, $showhide[$onoff], - wfArrayToCGI( array( $key => $onoff ), $changed ) + $link = $this->skin->link( $self, $showhide[$onoff], array(), + array( $key => $onoff ) + $changed ); $links[$key] = wfMsgHtml( $msg, $link ); } @@ -348,8 +352,6 @@ class NewPagesPager extends ReverseChronologicalPager { // Stored opts protected $opts, $mForm; - private $hideliu, $hidepatrolled, $hidebots, $namespace, $user, $spTitle; - function __construct( $form, FormOptions $opts ) { parent::__construct(); $this->mForm = $form; @@ -381,7 +383,7 @@ class NewPagesPager extends ReverseChronologicalPager { $rcIndexes = array( 'rc_timestamp' ); } $conds[] = 'page_id = rc_cur_id'; - $conds['page_is_redirect'] = 0; + # $wgEnableNewpagesUserFilter - temp WMF hack if( $wgEnableNewpagesUserFilter && $user ) { $conds['rc_user_text'] = $user->getText(); @@ -398,6 +400,10 @@ class NewPagesPager extends ReverseChronologicalPager { $conds['rc_bot'] = 0; } + if ( $this->opts->getValue( 'hideredirs' ) ) { + $conds['page_is_redirect'] = 0; + } + return array( 'tables' => array( 'recentchanges', 'page' ), 'fields' => 'rc_namespace,rc_title, rc_cur_id, rc_user,rc_user_text,rc_comment, diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index d9175fc40a..cb4cb2f3db 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2095,6 +2095,7 @@ Each row contains links to the first and second redirect, as well as the target 'newpages' => 'New pages', 'newpages-summary' => '', # do not translate or duplicate this message to other languages 'newpages-username' => 'Username:', +'newpages-showhideredirs' => '$1 redirects', 'ancientpages' => 'Oldest pages', 'ancientpages-summary' => '', # do not translate or duplicate this message to other languages 'move' => 'Move', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index ce668c8374..c0b2b66045 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1363,6 +1363,7 @@ $wgMessageStructure = array( 'newpages', 'newpages-summary', 'newpages-username', + 'newpages-showhideredirs', 'ancientpages', 'ancientpages-summary', 'move', -- 2.20.1